Skip to content

[SYCLomaitc] Migrate 2 CUDA IPC code to level zero APIs.#2818

Closed
ShengchenJ wants to merge 3 commits into
oneapi-src:SYCLomaticfrom
ShengchenJ:add_event
Closed

[SYCLomaitc] Migrate 2 CUDA IPC code to level zero APIs.#2818
ShengchenJ wants to merge 3 commits into
oneapi-src:SYCLomaticfrom
ShengchenJ:add_event

Conversation

@ShengchenJ

Copy link
Copy Markdown
Contributor

No description provided.

ShengchenJ added 3 commits May 5, 2025 23:04
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
@ShengchenJ ShengchenJ requested a review from a team as a code owner May 6, 2025 06:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates two CUDA IPC code paths to level zero APIs by introducing new types and functions for IPC event pool handling and updating type mappings.

  • Added a new type and functions in ze_utils.hpp to support event pool creation and IPC handling.
  • Updated RulesLang.cpp to check for experimental usage of the new cudaIpcEventHandle_st and revised the namespace mappings in MapNames.cpp.

Reviewed Changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 2 comments.

File Description
clang/runtime/dpct-rt/include/dpct/ze_utils.hpp Adds new structures and functions for creating and handling Level Zero event pool IPC.
clang/lib/DPCT/RulesLang/RulesLang.cpp Inserts experimental feature support for cudaIpcEventHandle_st with an updated check.
clang/lib/DPCT/RuleInfra/MapNames.cpp Updates type mapping to include cudaIpcEventHandle_t to the new experimental type.
Files not reviewed (3)
  • clang/lib/DPCT/RulesLang/APINamesMisc.inc: Language not supported
  • clang/lib/DPCT/SrcAPI/APINames.inc: Language not supported
  • clang/test/dpct/IPC/share_mem_exp_option.cu: Language not supported

if (CanonicalTypeStr == "cudaIpcEventHandle_st") {
if (!DpctGlobalInfo::useExtLevelZero()) {
report(TL->getBeginLoc(), Diagnostics::TRY_EXPERIMENTAL_FEATURE, false,
"cudaIpcMemHandle_t", "--use-experimental-features=level_zero");

Copilot AI May 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The report message within this block uses 'cudaIpcMemHandle_t' instead of 'cudaIpcEventHandle_t', which may confuse users expecting the correct type name. Please update the string to 'cudaIpcEventHandle_t' to reflect the correct experimental feature.

Suggested change
"cudaIpcMemHandle_t", "--use-experimental-features=level_zero");
"cudaIpcEventHandle_t", "--use-experimental-features=level_zero");

Copilot uses AI. Check for mistakes.
int fd = detail::get_fd_of_peer_process(hipc);
if (fd < 0)
throw std::runtime_error("Cannot get file descriptor of peer process.");
*((int *)hipc.handle.data) = detail::get_fd_of_peer_process(hipc);

Copilot AI May 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting hipc.handle.data to an int pointer directly might lead to issues if the underlying type of handle.data is not guaranteed to store an integer file descriptor. Consider using a safer method, like memcpy or a static_cast/reinterpret_cast with appropriate validation.

Copilot uses AI. Check for mistakes.
@ShengchenJ

Copy link
Copy Markdown
Contributor Author

Temp disable.

@ShengchenJ ShengchenJ closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants